		var currDT;
		var aryDay = new Array("日","一","二","三","四","五","六");//显示星期
		var timed=new Array("08:30-10:30","10:20-11:50","12:30-14:00","14:20-15:50","16:10-17:40","19:00-20:30","08:15-09:45","13:30-15:00","16:30-19:30","18:00-19:00","18:30-19:30");
		var wcolor=new Array("#cef3db","#ffe2d8","#e2ccf1","#fcd6de","#d0eff6","#f4cff0","#bfe7fd");
		var lastDay;//页面显示的最后一天
		var firstDay;//页面显示的第一天

		//初始化日期加载
		function initDate(s,t) {
			t=t.replace(/-/g,"/");
			s=s.replace(/-/g,"/");
			var lplan=document.getElementById("liveplan").value;
			currDT = new Date(t);
			var cdt= new Date(t);
			var cot= new Date(s);
			$(".showDate2.year").html(currDT.getFullYear());
			$(".showDate2.month").html(currDT.getMonth()+1);
			var dw1 = currDT.getDay();//从Date对象返回一周中的某一天(0~6)
			var tdDT;//日期
			var crtDT=currDT.getDate();
			var a=currDT.getMonth();
			var b;
			//处理JSON数组{"id":0,"date":"2014-4-29","wid":0,"tid":7}
			//本函数废弃id
			if (lplan!=''){
			//	lplan=eval('('+lplan+')');
				var n=lplan.split('|');
			}

			//在表格中显示一月的日期
			var objTB = document.getElementById("mytable");//取得表格对象
			cdt.setDate(1);
			var mst=cdt.getDay();
			if (mst>4){
				var zrow=6;
				$("#mt_yc").show();
			}else{
				var zrow=5;
				$("#mt_yc").hide();
			}
			cdt.setDate(0-mst);
			for(var i=0;i<zrow;i++){
				for(var j=0;j<7;j++){
					cdt.setDate(cdt.getDate()+1);
					objTB.rows[i].cells[j].style.background='#fafafa';
					b=cdt.getFullYear()+'-'+(cdt.getMonth()+1)+'-'+cdt.getDate();
					b="'"+b+"'";
						if(cdt<cot){
							objTB.rows[i].cells[j].style.cursor="";
							objTB.rows[i].cells[j].innerHTML='<div id='+b+'><div class="Rinum"><font color=#ccc>'+cdt.getDate()+'</font></div></div>';
						}else{

							objTB.rows[i].cells[j].style.cursor='pointer';
							if (cdt.getMonth()!=a){
								objTB.rows[i].cells[j].innerHTML='<div id='+b+' onclick="sdsel('+b+')"><div class="Rinum"><font color=#999>'+cdt.getDate()+'</font></div></div>';
							}else{
								objTB.rows[i].cells[j].innerHTML='<div id='+b+' onclick="sdsel('+b+')"><div class="Rinum">'+cdt.getDate()+'</div></div>';
							}
						}
				}
			}
			if (lplan!=''){
				for(i=0;i<n.length;i++){
					var m=n[i].split('_');
					var c=m[1].replace(/-/g,"/");
					var sdt=new Date(c);
					b=sdt.getFullYear()+'-'+(sdt.getMonth()+1)+'-'+sdt.getDate();
					b="'"+b+"'";
					if (sdt>=cot){
						$('#'+m[1]).parent().css("cursor","pointer");
						$('#'+m[1]).parent().css("background",wcolor[m[2]]);
						if(sdt.getMonth()!=a){
							$('#'+m[1]).parent().html('<div class="Posbtn" onmouseout="dhide(this)"><div class="Pofont">第<font>'+(i+1)+'</font>讲</div><div class="Pobleft" onclick=sdedit('+b+')></div><div class="Pobright" onclick=sddel('+b+')></div></div><div id='+b+' onmouseover="dshow(this)"><div class=Rinum><font color=#999>'+sdt.getDate()+'</font></div><div class=Riselect><font color=#999 style="font-size:12px">'+timed[m[3]-1]+'</font></div></div>');
						}else{
							$('#'+m[1]).parent().html('<div class="Posbtn" onmouseout="dhide(this)"><div class="Pofont">第<font>'+(i+1)+'</font>讲</div><div class="Pobleft" onclick=sdedit('+b+')></div><div class="Pobright" onclick=sddel('+b+')></div></div><div id='+b+' onmouseover="dshow(this)"><div class=Rinum>'+sdt.getDate()+'</div><div class=Riselect><font style="font-size:12px">'+timed[m[3]-1]+'</font></div></div>');
						}
					}else{
						$('#'+m[1]).parent().css("cursor","");
						$('#'+m[1]).parent().css("background","#fafafa");
						$('#'+m[1]).parent().html('<div><div class=Rinum><font color=#ccc>'+sdt.getDate()+'</font></div><div class=Riselect><font color=#ccc style="font-size:12px">'+timed[m[3]-1]+'</font></div></div>');
					}
				}
				var kst1=n[0].split('_');
				var kst2=timed[kst1[3]-1].split('-');
				var kst=kst1[1]+' '+kst2[0];
				$("#kstime").val(kst);
				var ket1=n[n.length-1].split('_');
				var ket2=timed[ket1[3]-1].split('-');
				var ket=ket1[1]+' '+ket2[1]
				$("#ketime").val(ket);
			}
		}

		//删除当前日期
		function sddel(t){
			var ww=$("#isqx").val();
			if(ww==2){
				return;
			}
			var lnum=$("#liveidnum").val();
			var p=document.getElementById("begindate").value;
			var w=t.replace(/-/g,"/");
			var s=new Date(w);
			var wid=s.getDay();
			var pjson=$("#liveplan").val();
			var tdstr=$("#wktm").val();
			var h='';
			var x;
			var y;
			var lplan=pjson.split('|');
			tdstr=qmsort(tdstr);
			var tdsp=tdstr.split('|');

			var lps=lplan[lplan.length-1].split('_');
			for(var i=0;i<tdsp.length;i++){
				var a=tdsp[i].split('_');
				if(parseInt(a[0])==parseInt(lps[2])){
					x=i;
					break;
				}
			}
			if(x==(tdsp.length-1)){
				var tds1=tdsp[0].split('_');
				var tds2=tdsp[tdsp.length-1].split('_');
				var td1=tds1[0];
				var td2=tds1[1];
				var tds=7-(parseInt(tds2[0])-parseInt(tds1[0]));
			}else{
				var tds1=tdsp[x+1].split('_');
				var td1=tds1[0];
				var td2=tds1[1];
				var tds=parseInt(tds1[0])-parseInt(lps[2]);
			}
			var f=lps[1].replace(/-/g,"/");
			var xdt=new Date(f);
			xdt.setDate(xdt.getDate()+tds);
			var dt=xdt.getFullYear()+'-'+(xdt.getMonth()+1)+'-'+xdt.getDate();

			//删除

			for(i=0;i<lplan.length;i++){
				var c=lplan[i].split('_');
				if (c[1]==t){
					y=i;
					break;
				}
			}
			var darr=lplan.splice(y,1);
			h=lplan.join('|');
			//添加

			h+='|'+lnum+'_'+dt+'_'+td1+'_'+td2;
			h=arrsort(h);
			$("#liveplan").val(h);
			initDate(p,t);
		}

		//表格点击事件
		function sdsel(t){
			var ww=$("#isqx").val();
			if(ww==2){
				return;
			}
			var lnum=$("#liveidnum").val();
			if (lnum==0){
				alert('请先添加课程大纲！');
				return;
			}
			var k=t.replace(/-/g,"/");
			var sdt=new Date(k);
			var wid=sdt.getDay();
			var pjson=$("#liveplan").val();
			if(pjson!=''){
				var lplan=pjson.split('|');
				var a=lplan[(lplan.length-1)].split('_');
				var f=a[1].replace(/-/g,"/");
				var xdt=new Date(f);
				if(xdt<sdt){
					alert('您的课程已满！');
					return;
				}
				var ish=0;
				for(i=0;i<lplan.length;i++){
					var ab=lplan[i].split('_');
					if(ab[2]==wid){
						ish=ab[3];
						break;
					}
				}
				for(i=0;i<lplan.length;i++){
					var ab=lplan[i].split('_');
					var ac=ab[1].replace(/-/g,"/");
					var adt=new Date(ac);
					if(sdt<adt){
						var isj=i;
						break;
					}
				}

			}
			var h='<option value="0">选择时间段</option>';
			var w='sel'+t;
			for(var i=0;i<timed.length;i++){
				h+='<option value='+(i+1)+'>'+timed[i]+'</option>';
			}
			var u="'"+t+"'";
			var s=$('#'+t).children().html();
			var parh=$('#'+t).parent().html();

			if(parh.indexOf('Riselect')!=-1){

				$('#'+t).parent().html('<div id='+t+' onclick="sdsel('+u+')"><div class="Rinum">'+s+'</div></div>');
			}else{
				if(ish>0){
					var ww=isj+'_'+t+'_'+wid+'_'+ish;
					lplan.splice(isj,0,ww);
					lplan.length=lnum;
					var hhh=lplan.join('|');
					$("#liveplan").val(hhh);
					initDate($("#begindate").val(),t);
				}else{
					$('#'+t).parent().html('<div id='+t+'><div class=Rinum onclick="sdsel('+u+')">'+s+'</div><div class=Riselect><select id='+w+' onchange="sdadd('+u+')">'+h+'</select></div></div>');
				}
			}

		}

		//时间段修改事件
		function sdedit(t){
			var ww=$("#isqx").val();
			if(ww==2){
				return;
			}
			var h='';
			var w='sel'+t;
			var tdstr=$("#wktm").val();
			var a=tdstr.split('|');
			var tid;
			var v=t.replace(/-/g,"/");
			var s=new Date(v);
			var wid=s.getDay();
			for(var i=0;i<a.length;i++){
				var b=a[i].split('_');
				if(parseInt(b[0])==parseInt(wid)){
					tid=b[1];
				}
			}
			for(var i=0;i<timed.length;i++){
				if(parseInt(tid)==(i+1)){
					h+='<option value='+(i+1)+' selected>'+timed[i]+'</option>';
				}else{
					h+='<option value='+(i+1)+'>'+timed[i]+'</option>';
				}
			}
			var u="'"+t+"'";
			var s=$('#'+t).children(".Rinum").html();
			$('#'+t).parent().html('<div id='+t+'><div class=Rinum>'+s+'</div><div class=Riselect><select id='+w+' onchange=subedit('+u+')>'+h+'</select></div></div>');
		}

		function subedit(t){
			var ww=$("#isqx").val();
			if(ww==2){
				return;
			}
			var p=document.getElementById("begindate").value;
			var w=t.replace(/-/g,"/");
			var s=new Date(w);
			var wid=s.getDay();
			var a='sel'+t;
			var b=document.getElementById(a);
			var u=b.options[b.selectedIndex].value;
			var pjson=$("#liveplan").val();
			var tdstr=$("#wktm").val();
			var h='';
			var x='';

			var tdsp=tdstr.split('|');
			for(var i=0;i<tdsp.length;i++){
				var c=tdsp[i].split('_');
				if(parseInt(c[0])==parseInt(wid)){
					c[1]=u;
				}
				if (i==0){
					x=c.join('_');
				}else{
					x+='|'+c.join('_');
				}
			}
			//修改已选当天时间
			var lplan=pjson.split('|')
			for(i=0;i<lplan.length;i++){
				var d=lplan[i].split('_');
				if (parseInt(d[2])==wid){
					d[3]=u;
				}
				if (i==0){
					h=d.join('_');
				}else{
					h+='|'+d.join('_');
				}
			}
			h=arrsort(h);
			$("#liveplan").val(h);
			$("#wktm").val(x);
			initDate(p,t);
		//	alert(x);
		}

		//时间段选择事件
		function sdadd(t){
			var ww=$("#isqx").val();
			if(ww==2){
				return;
			}
			var lnum=$("#liveidnum").val();
			if (lnum==0){
				alert('请先添加课程大纲！');
				return;
			}
			var p=document.getElementById("begindate").value;
			var w=t.replace(/-/g,"/");
			var s=new Date(w);
			var wid=s.getDay();
			var a='sel'+t;
			var b=document.getElementById(a);
			var u=b.options[b.selectedIndex].value;
			var pjson=$("#liveplan").val();
			var dt;
			var z=$("#wktm").val();
			var x='';
			var h='';
			var str;
			var hstr;
			var m=0;
			if (pjson==''){
				x=wid+'_'+u;
				h='0_'+t+'_'+wid+'_'+u;
				if(lnum>1){
					for(var i=1;i<lnum;i++){
						s.setDate(s.getDate()+7);
						dt=s.getFullYear()+'-'+(s.getMonth()+1)+'-'+s.getDate();
						h+='|'+(parseInt(i)+1)+'_'+dt+'_'+wid+'_'+u;
					}
				}
			}else{
				//每周时间段
				var parr=pjson.split('|');
				var k=z.split('|');
				for (var i=0;i<k.length;i++){
					var a=k[i].split('_');
					if(parseInt(z[0])==wid){
						m=1;
						break;
					}
				}
				x=$("#wktm").val();
				if (m==0){
					x+='|'+wid+'_'+u;
				}
				x=qmsort(x);

				//处理事件
				h=pjson+'|0_'+t+'_'+wid+'_'+u;
				for(i=1;i<lnum;i++){
					s.setDate(s.getDate()+7);
					dt=s.getFullYear()+'-'+(s.getMonth()+1)+'-'+s.getDate();
					h+='|0_'+dt+'_'+wid+'_'+u;
				}
				h=h.split('|');
				h=arrdel(h);
				h=h.join('|');
				h=arrsort(h);
				h=h.split('|');
				h.length=lnum;
				h=h.join('|');
			}
			$("#liveplan").val(h);
			$("#wktm").val(x);
			initDate(p,t);
		}

function btm(t1,t2){
	var w1=t1[1].replace(/-/g,"/");
	var s1=new Date(w1);
	var w2=t2[1].replace(/-/g,"/");
	var s2=new Date(w2);
	if(s1>s2){
		return 1;
	}else{
		return -1;
	}
}
function arrsort(t){
	var	h=t.split("|");
	for(i=0;i<h.length;i++){
		h[i]=h[i].split('_');
	}
	h.sort(btm);
	for(i=0;i<h.length;i++){
		h[i]=h[i].join('_');
	}
	h=h.join("|")
	return h;
}
function qmarr(t1,t2){
	var a=parseInt(t1[0]);
	var b=parseInt(t2[0]);
	if(a>b){
		return 1;
	}else{
		return -1;
	}
}
function qmsort(t){
	var	h=t.split("|")
	for(i=0;i<h.length;i++){
		h[i]=h[i].split('_');
	}
	h.sort(qmarr);
	for(i=0;i<h.length;i++){
		h[i]=h[i].join('_');
	}
	h=h.join("|")
	return h;
}
function arrdel(arr){
	for(var i=arr.length-1;i>=0;i--){
		var a=arr[i].split('_');
		for(j=0;j<i;j++){
			var b=arr[j].split('_');
			if(b[1]==a[1]){
				arr.splice(i,1);
				break;
			}
		}
	}
	return arr;
}

function adjestplan(){
	var lnum=$("#liveidnum").val();
	var pjson=$("#liveplan").val();
	if(lnum==0 && pjson==''){
		return;
	}
	if (lnum>0 && pjson==''){
		return;
	}
	var wktm=$("#wktm").val();
	var parr=pjson.split('|');
	var h='';
	if(parr.length==lnum){
		return;
	}
	if(parr.length>lnum){
		parr.length=lnum;
		h=parr.join('|');
		$("#liveplan").val(h);
		return;
	}
	var t=lnum-parr.length;
	var warr=wktm.split('|');
	var r=0;
	h=$("#liveplan").val();
	for(var j=1;j<=t;j++){
		for(var i=(parr.length-warr.length);i<parr.length;i++){
			if(r<t){
				var c=parr[i].split('_');
				var d=c[1].replace(/-/g,"/");
				var sdt=new Date(d);
				sdt.setDate(sdt.getDate()+j*7);
				var dt=sdt.getFullYear()+'-'+(sdt.getMonth()+1)+'-'+sdt.getDate();
				h+='|0_'+dt+'_'+c[2]+'_'+c[3];
				r++;
			}else{
				break;
			}
		}
	}
	$("#liveplan").val(h);
	var st=document.getElementById("begindate").value;
	var et=parr[0].split('_');
	initDate(st,et[1]);
}


function scity(){
	var u=document.getElementById('province');
	var w=u.options[u.selectedIndex].value;
	document.getElementById('pidh').value=w;
	var a=document.getElementById('sidh').value;
	var b=document.getElementById('nidh').value;
	var c=document.getElementById('kidh').value;
	var d=document.getElementById('jidh').value;
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    {
		  var s=xmlhttp.responseText.split('|');
	    document.getElementById("city").innerHTML=s[0];
	    document.getElementById('isnd').innerHTML=s[1];
	    document.getElementById('isjd').innerHTML=s[2];
	    var o=document.getElementById('iszd');
	    if(o){
	    	o.innerHTML=s[3];
	    }
	    }
	  }
	xmlhttp.open("GET","index.php?app=system&ac=ajax&ts=city&pid="+w+"&sid="+a+"&nid="+b+"&kid="+c+"&jid="+d,true);
	xmlhttp.setRequestHeader("If-Modified-Since","0");
	xmlhttp.send();
}
function cssl(mid){
	var u=document.getElementById('sxid');
	var w=u.options[u.selectedIndex].value;
	document.getElementById('sidh').value=w;
	var a=document.getElementById('pidh').value;
	var b=document.getElementById('nidh').value;
	var c=document.getElementById('kidh').value;
	var d=document.getElementById('jidh').value;
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    {
		  var s=xmlhttp.responseText.split('|');
	    document.getElementById("isnd").innerHTML=s[0];
	    document.getElementById('iskd').innerHTML=s[1];
	    document.getElementById('isjd').innerHTML=s[2];
	    var o=document.getElementById('iszd');
	    if(o){
	    	o.innerHTML=s[3];
	    }
	    $("#fmcc").html(s[4]);
	    }
	  }
	xmlhttp.open("GET","index.php?app=system&ac=ajax&ts=cssl&pid="+a+"&sid="+w+"&nid="+b+"&kid="+c+"&jid="+d+"&mid="+mid,true);
	xmlhttp.setRequestHeader("If-Modified-Since","0");
	xmlhttp.send();
}
function cnid(){
	var u=document.getElementById('njid');
	var w=u.options[u.selectedIndex].value;
	document.getElementById('nidh').value=w;
	var a=document.getElementById('pidh').value;
	var b=document.getElementById('sidh').value;
	var c=document.getElementById('kidh').value;
	var d=document.getElementById('jidh').value;
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    {
		  var s=xmlhttp.responseText.split('|');
		  document.getElementById('isjd').innerHTML=s[0];
		  document.getElementById('iszd').innerHTML=s[1];
	//	  document.getElementById('fmcc').innerHTML=s[2];
	    }
	  }
	xmlhttp.open("GET","index.php?app=system&ac=ajax&ts=cnid&pid="+a+"&sid="+b+"&nid="+w+"&kid="+c+"&jid="+d,true);
	xmlhttp.setRequestHeader("If-Modified-Since","0");
	xmlhttp.send();
}
function ckid(){
	var u=document.getElementById('kmid');
	var w=u.options[u.selectedIndex].value;
	document.getElementById('kidh').value=w;
	var a=document.getElementById('pidh').value;
	var b=document.getElementById('sidh').value;
	var c=document.getElementById('nidh').value;
	var d=document.getElementById('jidh').value;
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    {
		  var s=xmlhttp.responseText.split('|');
		  document.getElementById('isjd').innerHTML=s[0];
		    document.getElementById('iszd').innerHTML=s[1];
	//	    document.getElementById('fmcc').innerHTML=s[2];
	    }
	  }
	xmlhttp.open("GET","index.php?app=system&ac=ajax&ts=cnid&pid="+a+"&sid="+b+"&nid="+c+"&kid="+w+"&jid="+d,true);
	xmlhttp.setRequestHeader("If-Modified-Since","0");
	xmlhttp.send();
}
function cjid(){
	var u=document.getElementById('jcid');
	var w=u.options[u.selectedIndex].value;
	document.getElementById('jidh').value=w;
	var a=document.getElementById('pidh').value;
	var b=document.getElementById('sidh').value;
	var c=document.getElementById('nidh').value;
	var d=document.getElementById('kidh').value;
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    {
		    document.getElementById('iszd').innerHTML=xmlhttp.responseText;
	    }
	  }
	xmlhttp.open("GET","index.php?app=system&ac=ajax&ts=cjid&pid="+a+"&sid="+b+"&nid="+c+"&kid="+d+"&jid="+w+"&tmp="+Math.random(),true);
	xmlhttp.setRequestHeader("If-Modified-Since","0");
	xmlhttp.send();
}
function checknc(){
	var w=document.getElementById('ncname').value;
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    {
	    document.getElementById("checknc").innerHTML=xmlhttp.responseText;
	    }
	  }
	xmlhttp.open("GET","index.php?app=system&ac=ajax&ts=checknc&nc="+w,true);
	xmlhttp.setRequestHeader("If-Modified-Since","0");
	xmlhttp.send();
}
function showtag(){
	document.getElementById('xxtag').style.display="";
}

function selt(t){
	var w=document.getElementById('tagshow').innerHTML;
	var u='<a class="ctag" href="javascript:void(0)" onclick="delt(this)">'+t.innerHTML+'</a>';
	var s=w.indexOf(t.innerHTML);
	if(s==-1){
	document.getElementById('tagshow').innerHTML+=u;
	document.getElementById('tagh').value+=','+t.innerHTML;
	}
}
function delt(t){
	t.innerHTML='';
	var w=document.getElementById('tagh').value;
	var u=','+t.innerHTML;
	document.getElementById('tagh').value=w.replace(u,'');
}

function livekc(){
	document.getElementById('livekc').style.display='';
}
function conkc(){
	var w=document.getElementById('livekcinfo').value;
	var b=w.split('|||');
	for(var i=1;i<b.length;i++){
		var a=b[i].split('$$$');
		if(a[1]==''){
			alert('课程标题不能为空！');
			return;
		}
	}

	document.getElementById('lnum').value=b.length-1;
	document.getElementById('liveidnum').value=b.length-1;
	document.getElementById('livekc').style.display='none';
}
function kcblur(t){
	var w='kc'+t;
	var s=$('#'+w).val();
	var kinfo=$("#livekcinfo").val();
	var a=kinfo.split('|||');
	var b=a[t].split('$$$');
	b[1]=s;
	b=b.join('$$$');
	a[t]=b;
	a=a.join('|||');
	$("#livekcinfo").val(a);
}
function addkc(){
	var sal=$("#liveidnum").val();
	sal=parseInt(sal)+1;
	$("#liveidnum").val(sal)
	var kinfo=$("#livekcinfo").val();
	var a=kinfo.split('|||');
	var w='';
	for(var i=1;i<a.length;i++){
		var b=a[i].split('$$$');
		if(i==1){
			w='<div id="kcv'+i+'" style="margin:10px 20px;">第&nbsp;'+i+'&nbsp;讲：<input type="text" id="kc'+i+'" size="60" onblur=kcblur('+i+') value="'+b[1]+'" /><input type="button" value="增加课程" style="margin-left:30px;" onclick="addkc()"></div>'
		}else{
		w+='<div id="kcv'+i+'" style="margin:10px 20px;">第&nbsp;'+i+'&nbsp;讲：<input type="text" id="kc'+i+'" size="60" onblur=kcblur('+i+') value="'+b[1]+'" />&nbsp;&nbsp;<a href=javascript:void(0) onclick="adkcdel('+i+')">删除</a></div>';
		}
	}
	w+='<div id="kcv'+sal+'" style="margin:10px 20px;">第&nbsp;'+sal+'&nbsp;讲：<input type="text" id="kc'+sal+'" size="60" onblur=kcblur('+sal+') />&nbsp;&nbsp;<a href=javascript:void(0) onclick="adkcdel('+sal+')">删除</a></div>';
	$("#livekclist").html(w);
	var u=$("#livekcinfo").val();
	u+='|||'+sal+'$$$';
	$("#livekcinfo").val(u);
	$("#lnum").val(sal);
	if($("#dprice").val()>0){
		var dp=$("#dprice").val()*sal;
		$("#zprice").val(dp);
	}
}
function adkcdel(t){
	var kinfo=$("#livekcinfo").val();
	var a=kinfo.split('|||');
	var sal=$("#liveidnum").val();
	sal=parseInt(sal)-1;
	a.splice(t,1);
	var h='';
	var w='';
	for(var i=1;i<a.length;i++){
		var b=a[i].split('$$$');
		b[0]=i;
		h+='|||'+b.join('$$$');
		if(i==1){
			w='<div id="kcv'+i+'" style="margin:10px 20px;">第&nbsp;'+i+'&nbsp;讲：<input type="text" id="kc'+i+'" size="60" onblur=kcblur('+i+') value="'+b[1]+'" /><input type="button" value="增加课程" style="margin-left:30px;" onclick="addkc()"></div>'
		}else{
		w+='<div id="kcv'+i+'" style="margin:10px 20px;">第&nbsp;'+i+'&nbsp;讲：<input type="text" id="kc'+i+'" size="60" onblur=kcblur('+i+') value="'+b[1]+'" />&nbsp;&nbsp;<a href=javascript:void(0) onclick="adkcdel('+i+')">删除</a></div>';
		}
	}
	$("#livekclist").html(w);
	$("#livekcinfo").val(h);
	$("#liveidnum").val(sal);
	$("#lnum").val(sal);
	if($("#dprice").val()>0){
		var dp=$("#dprice").val()*sal;
		$("#zprice").val(dp);
	}
}
function jspr(){
	var pr=document.getElementById('dprice').value;
	var num=document.getElementById('lnum').value;
	if (pr>=0 && num>0){
		var prc=pr*num;
		document.getElementById('zprice').value=prc;
	}
}

//left menu
$(function(){
	$(".type").click(function(){
		$(".content").hide();
		$(this).next(".content").slideDown("slow");
	});
});
function fmenu(t,w){
	$(".content").hide();
	$(".content:eq("+t+")").show();
	$(".content:eq("+t+")").children().children("li:eq("+w+")").children("a").css("color","#FF0000");
}

//省市ajax
function selcity(){
	var u=document.getElementById('province');
	var w=u.options[u.selectedIndex].value;
	$.ajax({
		type: "GET",
		cache:"false",
		url:  "index.php?app=system&ac=ajax&ts=selcity",
		data: "pid="+w,
		success: function(msg){
			$("#citylist").html(msg);
		}
	});
}
//学校年级AJAX
function selnj(){
	var u=document.getElementById('sxid');
	var w=u.options[u.selectedIndex].value;
	$.ajax({
		type: "GET",
		cache:"false",
		url:  "index.php?app=system&ac=ajax&ts=selnj",
		data: "sid="+w,
		success: function(msg){
			$("#njlist").html(msg);
		}
	});
}
function selnj1(){
	var u=document.getElementById('sxid');
	var w=u.options[u.selectedIndex].value;
	$.ajax({
		type: "GET",
		cache:"false",
		url:  "index.php?app=system&ac=ajax&ts=selnj1",
		data: "sid="+w,
		success: function(msg){
			$("#njlist").html(msg);
		}
	});
}